package ru.amse.tsyganov.jumleditor.view.lines;

import ru.amse.tsyganov.jumleditor.view.ConnectionPoint;

public abstract class ToConnectionPointLine extends ConnectionPointLine {
	
	public ToConnectionPointLine(ConnectionPoint p, int cord) {
		super(p, cord);
	}

	public int getX2() {
		return getConnectionPoint().getCpX();
		
	}

	public int getY2() {
		return getConnectionPoint().getCpY();
	}

	public void setX2(int x2) {
		throw new UnsupportedOperationException();	
	}

	public void setY2(int y2) {
		throw new UnsupportedOperationException();
	}

	public static ToConnectionPointLine createNewToConnectionPointLine(
			ConnectionPoint p, boolean isHorizontal, int cord) {
		
		return isHorizontal ? 
				new HorizontalToConnectionPointLine(p, cord) :
					new VerticalToConnectionPointLine(p, cord);
	}
}
